<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        /* var i = 1;
        while(i <= 100){
            console.log(i);
            i++;
        } */

        //偶数输出
       /*  var i = 1;
        while(i <= 100){
            if(i % 2 ==0){
                console.log(i);    
            }
            i++;
        } */
        
        //求和
       /*  var i = 1;
        var sum = 0;
        while(i <= 100){
            sum += i;
             i++;      
        }
        console.log(sum);  */

        //无限输出
        var sum = prompt('你好吗');
        while(sum != '好'){
            alert('你输入的不正确');
            sum = prompt('你好吗');          
        }
        alert('你也好');
    </script>
</body>
</html>